"use strict";
// get x() --> x(){...}为当读取属性x时触发的函数
// set x() --> x(){...}为当x重新赋值时触发的函数
// 只有get没有set的属性会被认为是只读的
var passcode = 'secret passcode';
var Employee = /** @class */ (function () {
    function Employee() {
        this._fullName = '';
    }
    Object.defineProperty(Employee.prototype, "fullName", {
        get: function () {
            return "\u8FD9\u662F\u4F60\u8981\u7684: " + this._fullName;
        },
        set: function (newVal) {
            if (passcode && passcode === 'secret passcode') {
                this._fullName = newVal;
            }
            else {
                console.log('密码错误');
            }
        },
        enumerable: true,
        configurable: true
    });
    return Employee;
}());
var employee = new Employee();
employee.fullName = '尼古拉斯·赵四';
if (employee.fullName) {
    alert(employee.fullName); // 这是你要的: 尼古拉斯·赵四
}
